using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Person.View
{
    public partial class frmPerson : Form
    {
        public frmPerson()
        {
            InitializeComponent();
        }

        Service.PersonService svc = new Person.Service.PersonService();
        private void frmPerson_Load(object sender, EventArgs e)
        {
            gridPerSon.DataSource = svc.RefreshGrid();
        }

        private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            if (gridView1.SelectedRowsCount == 1)
            {
                DataRow row = gridView1.GetFocusedDataRow();
                MessageBox.Show(((Model.Person) gridView1.GetFocusedRow()).FirstName);
            }
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            gridView1.AddNewRow();
            MessageBox.Show("add new row");
        }
    }
}